package com.online.service;

import com.online.dao.ExamMapper;
import com.online.entity.Exam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExamServiceImpl implements ExamService {

    @Autowired
    ExamMapper examMapper;

    @Override
    public int addAExam(Exam exam) {
        return examMapper.insertAExam(exam);
    }

    @Override
    public Integer showExamId(String teacherNumber, String examName) {
        return examMapper.selectExamId(teacherNumber,examName);
    }

    @Override
    public int showOptionsNumber(int examId) {
        return examMapper.selectOptionsNumberByExamId(examId);
    }

    @Override
    public int showBlanksNumber(int examId) {
        return examMapper.selectBlankNumberByExamId(examId);
    }

    @Override
    public List<Exam> showAllExam(String teacherNumber) {
        return examMapper.selectAllExam(teacherNumber);
    }

    @Override
    public int deleteARecord(int examId) {
        return examMapper.deleteAExamByExamId(examId);
    }

    @Override
    public Exam showAExam(int examId) {
        return examMapper.selectAExamByExamId(examId);
    }
}

